home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 007 (1987-02-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 007 (1987-02-15)(Ossowski, Stefan)(DE)(PD).adf / C Compiler / expr.h < prev    next >
C/C++ Source or Header  |  1987-03-04  |  2KB  |  68 lines

  1. /*
  2.  *    68000 C compiler
  3.  *
  4.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  5.  *    all commercial rights reserved.
  6.  *
  7.  *    This compiler is intended as an instructive tool for personal use. Any
  8.  *    use for profit without the written consent of the author is prohibited.
  9.  *
  10.  *    This compiler may be distributed freely for non-commercial use as long
  11.  *    as this notice stays intact. Please forward any enhancements or questions
  12.  *    to:
  13.  *
  14.  *        Matthew Brandt
  15.  *        Box 920337
  16.  *        Norcross, Ga 30092
  17.  */
  18.  
  19. /*      expression tree descriptions    */
  20.  
  21. enum e_node {
  22.         en_void,        /* used for parameter lists */
  23.         en_cbw, en_cbl, en_cwl, en_cld, en_cfd,
  24.         en_icon, en_fcon, en_labcon, en_nacon, en_autocon,
  25.         en_b_ref, en_w_ref, en_l_ref, en_ub_ref, en_uw_ref,
  26.         en_ul_ref, en_fcall, en_tempref, en_add, en_sub, en_mul, en_mod,
  27.         en_div, en_lsh, en_rsh, en_cond, en_assign, en_eq, en_ne,
  28.         en_asadd, en_assub, en_asmul, en_asdiv, en_asmod, en_asrsh,
  29.         en_aslsh, en_asand, en_asor, en_uminus, en_not, en_compl,
  30.         en_lt, en_le, en_gt, en_ge, en_and, en_or, en_land, en_lor,
  31.         en_xor, en_ainc, en_adec, en_umul, en_udiv, en_umod, en_ugt,
  32.         en_uge, en_ule, en_ult };
  33.  
  34. /*      statement node descriptions     */
  35.  
  36. enum e_stmt {
  37.         st_expr, st_while, st_for, st_do, st_if, st_switch,
  38.         st_case, st_goto, st_break, st_continue, st_label,
  39.         st_return };
  40.  
  41. struct enode {
  42.         enum e_node nodetype;
  43.         short constflag;
  44.         union {
  45.                 int             i;
  46.                 double          f;
  47.                 char            *sp;
  48.                 struct enode    *p[2];
  49.                 } v;
  50.         };
  51.  
  52. struct snode {
  53.         int                 stype;
  54.         struct snode    *next;          /* next statement */
  55.         struct enode    *exp;           /* condition or expression */
  56.         struct snode    *s1, *s2;       /* internal statements */
  57.         int             *label;         /* label number for goto */
  58.         };
  59.  
  60. struct cse {
  61.         struct cse      *next;
  62.         struct enode    *exp;           /* optimizable expression */
  63.         int             uses;           /* number of uses */
  64.         int             duses;          /* number of dereferenced uses */
  65.         int             voidf;          /* cannot optimize flag */
  66.         int             reg;            /* allocated register */
  67.         };
  68.